/**
 * @Author: GHeng.QD
 * @Date: 2022-04-06 09:19:03
 * @LastEditTime: 2022-04-11 15:03:06
 * @LastEditors: GHeng.QD
 * @Description: 
 * @FilePath: \producth:\work\wy-group\zhaocai_app\main.js
 * @
 */
import Vue from 'vue'
import App from './App'

import store from './store'
import request from 'common/request.js'

//任务&商城相关组件
import HttpRequest from './common/httpRequest'
import HttpCache from './common/cache'
import queue from './common/queue'
import empty from './components/empty'
import orangeGoodsCargHome from './components/uni-pro/orange-goods-card-home'
import loadMore from './components/uni-pro/load-more'
import orangeGoodsList from './components/uni-pro/orange-goods-list'
import orangeGoodsNewsList from './components/uni-pro/orange-goods-news-list'
import orangeGoodsCarg from './components/uni-pro/orange-goods-card'
import orangeHandpick from './components/uni-pro/orange-handpick'
import orangeMian from './components/uni-pro/orange-mian'
import orangeMians from './components/uni-pro/orange-mians'
import orangeNews from './components/uni-pro/orange-news'
import jdGoodsList from './components/uni-pro/jd-goods-list'
import uView from "@/node_modules/uview-ui";
import common from '@/common.js';
import ClUni from "cl-uni";

Vue.use(ClUni);

Vue.use(uView);
Vue.config.productionTip = false

Vue.prototype.$Request = HttpRequest;
Vue.prototype.$queue = queue;
Vue.prototype.$Sysconf = HttpRequest.config;
Vue.prototype.$SysCache = HttpCache;
Vue.prototype.$common = common;


Vue.prototype.$store = store
Vue.prototype.$backgroundAudioData = {
	playing: false,
	playTime: 0,
	formatedPlayTime: '00:00:00'
}
Vue.prototype.$adpid = "1111111111"
Vue.prototype.$request = request

Vue.mixin({
	methods: {
		setData: function(obj) {
			let that = this;
			let keys = [];
			let val, data;
			Object.keys(obj).forEach(function(key) {
				keys = key.split('.');
				val = obj[key];
				data = that.$data;
				keys.forEach(function(key2, index) {
					if (index + 1 == keys.length) {
						that.$set(data, key2, val);
					} else {
						if (!data[key2]) {
							that.$set(data, key2, {});
						}
					}
					data = data[key2];
				})
			});
		}
	}
});

App.mpType = 'app'

Vue.component('orange-news', orangeNews);
Vue.component('orange-handpick', orangeHandpick);
Vue.component('orange-mian', orangeMian);
Vue.component('orange-mians', orangeMians);
Vue.component('load-more', loadMore);
Vue.component('empty', empty);
Vue.component('orange-goods-list', orangeGoodsList);
Vue.component('orange-goods-news-list', orangeGoodsNewsList);
Vue.component('orange-goods-card', orangeGoodsCarg);
Vue.component('orange-goods-card-home', orangeGoodsCargHome);
Vue.component('jd-goods-list', jdGoodsList);

const app = new Vue({
	store,
	...App
})
app.$mount()
